Page Titles

jamesperet 9 years ago
parent
commit
ed801fe12e

+ 3 - 3
app/controllers/application_controller.rb

@@ -26,11 +26,11 @@ class ApplicationController < ActionController::Base
26 26
   
27 27
   def analytics
28 28
     if current_user != nil
29
-      id = current_user.full_name
29
+      @id_analytics = current_user.full_name
30 30
     else
31
-      id = 'Guest_'+ Time.now.to_i.to_s
31
+      @id_analytics = 'Guest_'+ Time.now.to_i.to_s
32 32
     end
33
-    @analytics ||= Analytics.new(id)
33
+    @analytics ||= Analytics.new(@id_analytics)
34 34
   end
35 35
   
36 36
   def after_sign_in_path_for(resource_or_scope)

+ 1 - 0
app/controllers/blog_posts_controller.rb

@@ -7,6 +7,7 @@ class BlogPostsController < ApplicationController
7 7
   # GET /blog_posts
8 8
   # GET /blog_posts.json
9 9
   def index
10
+    @title = "Blog"
10 11
     @blog_posts = BlogPost.order('created_at DESC')
11 12
   end
12 13
 

+ 3 - 1
app/helpers/application_helper.rb

@@ -1,3 +1,5 @@
1 1
 module ApplicationHelper
2
-
2
+  def title(page_title)
3
+      content_for(:title) { page_title }
4
+  end
3 5
 end

+ 12 - 6
app/models/analytics.rb

@@ -9,18 +9,24 @@ class Analytics
9 9
   end 
10 10
   
11 11
   def track(page)
12
-    @tracker.track(@id, page)
12
+    if Rails.env.production?
13
+      @tracker.track(@id, page)
14
+    end
13 15
   end
14 16
   
15 17
   def track_user_registration(user)
16
-    identify(user)
17
-    @tracker.track(user.full_name, 'User registration')
18
+    if Rails.env.production?
19
+      identify(user)
20
+      @tracker.track(user.full_name, 'User registration')
21
+    end
18 22
   end 
19 23
   
20 24
   def track_user_sign_in(user)
21
-    identify(user)
22
-    @tracker.track(user.full_name, 'User sign in')
23
-    @tracker.people.plus_one(user.full_name, "logins")
25
+    if Rails.env.production?
26
+      identify(user)
27
+      @tracker.track(user.full_name, 'User sign in')
28
+      @tracker.people.plus_one(user.full_name, "logins")
29
+    end
24 30
   end 
25 31
   
26 32
   private 

+ 1 - 0
app/views/admin_panel/contact_messages.html.erb

@@ -1,3 +1,4 @@
1
+<% title (t "admin_panel.contact_messages") + " - " + @config.website_name %>
1 2
 <div class="row">
2 3
 	<%= render 'admin_panel/sidebar_nav' %>
3 4
 	<div class="span9">

+ 2 - 0
app/views/admin_panel/dashboard.html.erb

@@ -1,3 +1,5 @@
1
+<% title (t "admin_panel.dashboard") + " - " + @config.website_name %>
2
+
1 3
 <div class="row">
2 4
 	<%= render 'admin_panel/sidebar_nav' %>
3 5
 	<div class="span9">

+ 1 - 0
app/views/admin_panel/files.html.erb

@@ -1,3 +1,4 @@
1
+<% title (t "admin_panel.files") + " - " + @config.website_name %>
1 2
 <div class="row">
2 3
 	<%= render 'admin_panel/sidebar_nav' %>
3 4
 	<div class="span9">

+ 1 - 0
app/views/admin_panel/maintenance_mode.html.erb

@@ -1,3 +1,4 @@
1
+<% title @config.maintenance_title + " - " + @config.website_name %>
1 2
 <div class="row">
2 3
 	<div class="span12">
3 4
 		<div class="hero-unit">

+ 1 - 0
app/views/admin_panel/posts.html.erb

@@ -1,3 +1,4 @@
1
+<% title (t "admin_panel.posts") + " - " + @config.website_name %>
1 2
 <div class="row">
2 3
 	<%= render 'admin_panel/sidebar_nav' %>
3 4
 	<div class="span9">

+ 1 - 0
app/views/admin_panel/show_contact_message.html.erb

@@ -1,3 +1,4 @@
1
+<% title @msg.title + " - " + @config.website_name %>
1 2
 <div class="row">
2 3
 	<%= render 'admin_panel/sidebar_nav' %>
3 4
 	<div class="span9">

+ 1 - 0
app/views/admin_panel/site_config.html.erb

@@ -1,3 +1,4 @@
1
+<% title (t "admin_panel.configurations") + " - " + @config.website_name %>
1 2
 <div class="row">
2 3
 	<%= render 'admin_panel/sidebar_nav' %>
3 4
 	<div class="span9">

+ 1 - 0
app/views/admin_panel/subscribers.html.erb

@@ -1,3 +1,4 @@
1
+<% title (t "admin_panel.subscribers") + " - " + @config.website_name %>
1 2
 <div class="row">
2 3
 	<%= render 'admin_panel/sidebar_nav' %>
3 4
 	<div class="span9">

+ 1 - 0
app/views/admin_panel/users.html.erb

@@ -1,3 +1,4 @@
1
+<% title (t "admin_panel.users") + " - " + @config.website_name %>
1 2
 <div class="row">
2 3
 	<%= render 'admin_panel/sidebar_nav' %>
3 4
 	<div class="span9">

+ 1 - 0
app/views/blog_posts/edit.html.erb

@@ -1,3 +1,4 @@
1
+<% title (t 'blog.edit_post') + ' - ' + @blog_post.title %>
1 2
 <div class="page-header">
2 3
   <h1><%= t "blog.edit_post" %></h1>
3 4
 </div>

+ 2 - 0
app/views/blog_posts/index.html.erb

@@ -1,3 +1,5 @@
1
+<% title "Blog - " + @config.website_name %>
2
+
1 3
 <div class="page-header">
2 4
   <h1>Blog</h1>
3 5
 </div>

+ 1 - 0
app/views/blog_posts/new.html.erb

@@ -1,3 +1,4 @@
1
+<% title (t "blog.new_post") + ' - ' + @config.website_name %>
1 2
 <div class="page-header">
2 3
   <h1><%= t "blog.new_post" %></h1>
3 4
 </div>

+ 2 - 0
app/views/blog_posts/show.html.erb

@@ -1,3 +1,5 @@
1
+<% title @blog_post.title + " - " + @config.website_name %>
2
+
1 3
 <div class="page-header">
2 4
   <h1><%= @blog_post.title %></h1>
3 5
   <small><%= t "blog.by" %> <%= @blog_post.author.full_name %>, <%= time_ago_in_words(@blog_post.created_at) %> <%= t "blog.ago" %></small> 

+ 2 - 0
app/views/contact_messages/index.html.erb

@@ -1,3 +1,5 @@
1
+<% title (t "contact.contact") + " - " + @config.website_name %>
2
+
1 3
 <div class="page-header">
2 4
 	<h1><%= t 'contact.contact'%></h1>
3 5
 </div>

+ 1 - 0
app/views/devise/passwords/edit.html.erb

@@ -1,3 +1,4 @@
1
+<% title (t 'registration.change_your_password') + ' - ' + @config.website_name %>
1 2
 <%= bootstrap_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
2 3
 	<div class="span4 offset4 well" style="">
3 4
 		<div class="login-panel panel panel-default">

+ 1 - 0
app/views/devise/passwords/new.html.erb

@@ -1,3 +1,4 @@
1
+<% title (t 'registration.forgot_password') + ' - ' + @config.website_name %>
1 2
 <%= bootstrap_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
2 3
 	<div class="span4 offset4 well" style="">
3 4
 		<div class="login-panel panel panel-default">

+ 1 - 0
app/views/devise/registrations/edit.html.erb

@@ -1,3 +1,4 @@
1
+<% title (t 'registration.edit_profile') + ' - ' + @config.website_name %>
1 2
 <%= bootstrap_form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>  
2 3
 	<div class="span6 offset3 media thumbnail" style="padding: 0px">
3 4
 		<div class="login-panel panel panel-default" style="padding: 10px;">

+ 1 - 0
app/views/devise/registrations/new.html.erb

@@ -1,3 +1,4 @@
1
+<% title (t 'registration.sign_up') + ' - ' + @config.website_name %>
1 2
 <%= bootstrap_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>  
2 3
 	<div class="span4 offset4 well" style="">
3 4
 		<div class="login-panel panel panel-default">

+ 1 - 0
app/views/devise/sessions/new.html.erb

@@ -1,3 +1,4 @@
1
+<% title (t 'registration.sign_in') + ' - ' + @config.website_name %>
1 2
 <%= bootstrap_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
2 3
 <div class="span4 offset4 well" style="">
3 4
 	<div class="login-panel panel panel-default">

+ 1 - 1
app/views/layouts/admin.html.erb

@@ -4,7 +4,7 @@
4 4
     <meta charset="utf-8">
5 5
     <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
6 6
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
-    <title><%= content_for?(:title) ? yield(:title) : "Admin - " + @config.website_name %></title>
7
+    <title><%= yield(:title) %></title>
8 8
     <%= csrf_meta_tags %>
9 9
 
10 10
     <!-- Le HTML5 shim, for IE6-8 support of HTML elements -->

+ 1 - 1
app/views/layouts/application.html.erb

@@ -4,7 +4,7 @@
4 4
     <meta charset="utf-8">
5 5
     <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
6 6
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
-    <title><%= content_for?(:title) ? yield(:title) : @config.website_name %></title>
7
+    <title><%= yield(:title) %></title>
8 8
     <%= csrf_meta_tags %>
9 9
 
10 10
     <!-- Le HTML5 shim, for IE6-8 support of HTML elements -->

+ 1 - 0
app/views/start/index.html.erb

@@ -1,3 +1,4 @@
1
+<% title @config.website_name %>
1 2
 <div class="hero-unit">
2 3
   <h1><%= @config.website_name %></h1>
3 4
   <p><%= @config.tagline %></p>

+ 1 - 0
app/views/uploads/edit.html.erb

@@ -1,3 +1,4 @@
1
+<% title (t 'uploads.edit_file') + ' - ' + @config.website_name %>
1 2
 <div class="page-header">
2 3
   <h1><%= t "uploads.edit_file" %></h1>
3 4
 </div>

+ 1 - 0
app/views/uploads/new.html.erb

@@ -1,3 +1,4 @@
1
+<% title (t 'uploads.upload_file') + ' - ' + @config.website_name %>
1 2
 <div class="page-header">
2 3
   <h1><%= t "uploads.upload_file" %></h1>
3 4
 </div>

+ 1 - 0
app/views/uploads/show.html.erb

@@ -1,3 +1,4 @@
1
+<% title @upload.title + ' - ' + @config.website_name %>
1 2
 <div class="page-header">
2 3
   <h1>
3 4
 	<%= @upload.title %>

+ 1 - 0
config/locales/en.yml

@@ -239,6 +239,7 @@ en:
239 239
     make_admin_error: User permission was not altered.
240 240
     permission_denied: You dont have permission to access that page!
241 241
     contact_messages: Messages
242
+    subscribers: Subscribers
242 243
   nav:
243 244
     admin_panel: Admin Panel
244 245
     account: Account

+ 2 - 1
config/locales/pt-BR.yml

@@ -241,6 +241,7 @@ pt-BR:
241 241
     make_admin_error: A permissão não foi alterada.
242 242
     permission_denied: Você não tem permissão para acessar aquela página!
243 243
     contact_messages: Mensagens
244
+    subscribers: Assinantes
244 245
   nav:
245 246
     admin_panel: Painel de Controle
246 247
     account: Conta
@@ -301,7 +302,7 @@ pt-BR:
301 302
     cancel_confirmation: Você tem certeza que deseja cancelar sua conta?
302 303
     edit_password: Editar senha
303 304
   subscription:
304
-    subscribers: Seguidores
305
+    subscribers: Assinantes
305 306
     header: Receba nossa newsletter
306 307
     submit: Enviar
307 308
     export: Exportart CVS